package client;

import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.imageio.ImageIO;
import javax.swing.ImageIcon;
import javax.swing.JFrame;
import javax.swing.JOptionPane;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * Formchat.java
 *
 * Created on Mar 12, 2011, 12:03:42 PM
 */

/**
 *
 * @author admin
 */
public class Formchat extends javax.swing.JFrame {

    /** Creates new form Formchat */
    public Formchat() throws IOException {
        initComponents();
  //      try {
 //           BufferedImage img = ImageIO.read(getClass().getResource("/image/paste.png"));
 //           jLbPaste.setIcon(new ImageIcon(SystemImage.scale(img, jLbPaste.getWidth(), jLbPaste.getHeight(), SystemImage.STRETCH_POS)));
 //      } catch (Exception e) {}
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jToolBar1 = new javax.swing.JToolBar();
        BtnLeave = new javax.swing.JButton();
        jSeparator2 = new javax.swing.JToolBar.Separator();
        BtnSave = new javax.swing.JButton();
        BtnMail = new javax.swing.JButton();
        BtnPrint = new javax.swing.JButton();
        jSeparator3 = new javax.swing.JToolBar.Separator();
        BtnCanned = new javax.swing.JButton();
        BtnView = new javax.swing.JButton();
        jToolBar2 = new javax.swing.JToolBar();
        jLabel1 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        jLabel3 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jLabel5 = new javax.swing.JLabel();
        LbName = new javax.swing.JLabel();
        LbEmail = new javax.swing.JLabel();
        LbDep = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        TaChat = new javax.swing.JTextArea();
        jToolBar3 = new javax.swing.JToolBar();
        BtnCut = new javax.swing.JButton();
        BtnCopy = new javax.swing.JButton();
        BtnPaste = new javax.swing.JButton();
        jPanel4 = new javax.swing.JPanel();
        jScrollPane1 = new javax.swing.JScrollPane();
        TaDisplay = new javax.swing.JTextArea();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenuItem1 = new javax.swing.JMenuItem();
        jSeparator1 = new javax.swing.JPopupMenu.Separator();
        jMenuItem2 = new javax.swing.JMenuItem();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        jPanel1.setBackground(new java.awt.Color(102, 102, 255));

        jToolBar1.setBackground(new java.awt.Color(176, 203, 246));
        jToolBar1.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        jToolBar1.setRollover(true);

        BtnLeave.setBackground(new java.awt.Color(176, 203, 246));
        BtnLeave.setText("Leave");
        BtnLeave.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        BtnLeave.setFocusable(false);
        BtnLeave.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        BtnLeave.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        BtnLeave.setMaximumSize(new java.awt.Dimension(40, 27));
        BtnLeave.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        BtnLeave.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtnLeaveActionPerformed(evt);
            }
        });
        jToolBar1.add(BtnLeave);
        jToolBar1.add(jSeparator2);

        BtnSave.setBackground(new java.awt.Color(176, 203, 246));
        BtnSave.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/save.png"))); // NOI18N
        BtnSave.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        BtnSave.setFocusable(false);
        BtnSave.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        BtnSave.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(BtnSave);

        BtnMail.setBackground(new java.awt.Color(176, 203, 246));
        BtnMail.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/mail-icon.png"))); // NOI18N
        BtnMail.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        BtnMail.setFocusable(false);
        BtnMail.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        BtnMail.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(BtnMail);

        BtnPrint.setBackground(new java.awt.Color(176, 203, 246));
        BtnPrint.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/printButton.png"))); // NOI18N
        BtnPrint.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        BtnPrint.setFocusable(false);
        BtnPrint.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        BtnPrint.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar1.add(BtnPrint);
        jToolBar1.add(jSeparator3);

        BtnCanned.setBackground(new java.awt.Color(176, 203, 246));
        BtnCanned.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/newspaper_copy.png"))); // NOI18N
        BtnCanned.setText("Canned");
        BtnCanned.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        BtnCanned.setFocusable(false);
        BtnCanned.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
        BtnCanned.setMaximumSize(new java.awt.Dimension(80, 49));
        BtnCanned.setMinimumSize(new java.awt.Dimension(80, 49));
        BtnCanned.setPreferredSize(new java.awt.Dimension(100, 17));
        BtnCanned.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        BtnCanned.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtnCannedActionPerformed(evt);
            }
        });
        jToolBar1.add(BtnCanned);

        BtnView.setBackground(new java.awt.Color(176, 203, 246));
        BtnView.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/Windows_View_Icon.png"))); // NOI18N
        BtnView.setText("ViewShare");
        BtnView.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        BtnView.setFocusable(false);
        BtnView.setHorizontalAlignment(javax.swing.SwingConstants.LEADING);
        BtnView.setHorizontalTextPosition(javax.swing.SwingConstants.RIGHT);
        BtnView.setMaximumSize(new java.awt.Dimension(100, 49));
        BtnView.setMinimumSize(new java.awt.Dimension(90, 49));
        BtnView.setPreferredSize(new java.awt.Dimension(100, 49));
        BtnView.setPressedIcon(new javax.swing.ImageIcon(getClass().getResource("/image/Windows_View_Icon.png"))); // NOI18N
        BtnView.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtnViewActionPerformed(evt);
            }
        });
        jToolBar1.add(BtnView);

        jToolBar2.setBackground(new java.awt.Color(102, 102, 255));
        jToolBar2.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        jToolBar2.setRollover(true);
        jToolBar2.setToolTipText("Chat");

        jLabel1.setText("Chat");
        jToolBar2.add(jLabel1);

        javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
        jPanel1.setLayout(jPanel1Layout);
        jPanel1Layout.setHorizontalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBar2, javax.swing.GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE)
            .addComponent(jToolBar1, javax.swing.GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE)
        );
        jPanel1Layout.setVerticalGroup(
            jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel1Layout.createSequentialGroup()
                .addComponent(jToolBar1, javax.swing.GroupLayout.PREFERRED_SIZE, 28, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jToolBar2, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap())
        );

        jPanel2.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel3.setText("Full name:");

        jLabel4.setText("E-mail:");

        jLabel5.setText("Department:");

        LbName.setFont(new java.awt.Font("Tahoma", 1, 11));
        LbName.setText("LbName");

        LbEmail.setFont(new java.awt.Font("Tahoma", 1, 11));
        LbEmail.setText("LbEmail");

        LbDep.setFont(new java.awt.Font("Tahoma", 1, 11));
        LbDep.setText("LbDep");

        javax.swing.GroupLayout jPanel2Layout = new javax.swing.GroupLayout(jPanel2);
        jPanel2.setLayout(jPanel2Layout);
        jPanel2Layout.setHorizontalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel3)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(LbName))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(LbEmail))
                    .addGroup(jPanel2Layout.createSequentialGroup()
                        .addComponent(jLabel5)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(LbDep)))
                .addContainerGap(305, Short.MAX_VALUE))
        );
        jPanel2Layout.setVerticalGroup(
            jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel2Layout.createSequentialGroup()
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel3)
                    .addComponent(LbName))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(LbEmail))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel5)
                    .addComponent(LbDep)))
        );

        TaChat.setColumns(20);
        TaChat.setRows(5);
        jScrollPane2.setViewportView(TaChat);

        jToolBar3.setBackground(new java.awt.Color(176, 203, 246));
        jToolBar3.setRollover(true);

        BtnCut.setBackground(new java.awt.Color(176, 203, 246));
        BtnCut.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/cut.png"))); // NOI18N
        BtnCut.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        BtnCut.setFocusable(false);
        BtnCut.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        BtnCut.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        BtnCut.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                BtnCutActionPerformed(evt);
            }
        });
        jToolBar3.add(BtnCut);

        BtnCopy.setBackground(new java.awt.Color(176, 203, 246));
        BtnCopy.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/copy.png"))); // NOI18N
        BtnCopy.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        BtnCopy.setFocusable(false);
        BtnCopy.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        BtnCopy.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar3.add(BtnCopy);

        BtnPaste.setBackground(new java.awt.Color(176, 203, 246));
        BtnPaste.setIcon(new javax.swing.ImageIcon(getClass().getResource("/image/gtk-paste.png"))); // NOI18N
        BtnPaste.setBorder(javax.swing.BorderFactory.createEmptyBorder(1, 1, 1, 1));
        BtnPaste.setFocusable(false);
        BtnPaste.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        BtnPaste.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jToolBar3.add(BtnPaste);

        javax.swing.GroupLayout jPanel3Layout = new javax.swing.GroupLayout(jPanel3);
        jPanel3.setLayout(jPanel3Layout);
        jPanel3Layout.setHorizontalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jToolBar3, javax.swing.GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE)
        );
        jPanel3Layout.setVerticalGroup(
            jPanel3Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel3Layout.createSequentialGroup()
                .addComponent(jToolBar3, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 41, Short.MAX_VALUE))
        );

        TaDisplay.setColumns(20);
        TaDisplay.setEditable(false);
        TaDisplay.setRows(5);
        jScrollPane1.setViewportView(TaDisplay);

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 421, Short.MAX_VALUE)
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 107, Short.MAX_VALUE)
        );

        jMenuBar1.setBackground(new java.awt.Color(176, 204, 246));

        jMenu1.setText("File");

        jMenuItem1.setText("Clear");
        jMenu1.add(jMenuItem1);
        jMenu1.add(jSeparator1);

        jMenuItem2.setText("Leave");
        jMenuItem2.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jMenuItem2ActionPerformed(evt);
            }
        });
        jMenu1.add(jMenuItem2);

        jMenuBar1.add(jMenu1);

        setJMenuBar(jMenuBar1);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addComponent(jPanel1, javax.swing.GroupLayout.PREFERRED_SIZE, 58, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel2, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel3, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void BtnViewActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnViewActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_BtnViewActionPerformed

    private void BtnLeaveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnLeaveActionPerformed
        // TODO add your handling code here:
        int i = JOptionPane.showConfirmDialog(this, "Do you want to leave");
        if (i==0)
        this.dispose();
    }//GEN-LAST:event_BtnLeaveActionPerformed

    private void BtnCutActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnCutActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_BtnCutActionPerformed

    private void BtnCannedActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_BtnCannedActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_BtnCannedActionPerformed

    private void jMenuItem2ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItem2ActionPerformed
        // TODO add your handling code here:
        int i = JOptionPane.showConfirmDialog(this, "Do you want to leave");
        if (i==0)
        this.dispose();
    }//GEN-LAST:event_jMenuItem2ActionPerformed

    /**
    * @param args the command line arguments
    */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                try {
                    new Formchat().setVisible(true);
                } catch (IOException ex) {
                    Logger.getLogger(Formchat.class.getName()).log(Level.SEVERE, null, ex);
                }
            }
        });
    }

    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton BtnCanned;
    private javax.swing.JButton BtnCopy;
    private javax.swing.JButton BtnCut;
    private javax.swing.JButton BtnLeave;
    private javax.swing.JButton BtnMail;
    private javax.swing.JButton BtnPaste;
    private javax.swing.JButton BtnPrint;
    private javax.swing.JButton BtnSave;
    private javax.swing.JButton BtnView;
    private javax.swing.JLabel LbDep;
    private javax.swing.JLabel LbEmail;
    private javax.swing.JLabel LbName;
    private javax.swing.JTextArea TaChat;
    private javax.swing.JTextArea TaDisplay;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JMenuItem jMenuItem1;
    private javax.swing.JMenuItem jMenuItem2;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JPopupMenu.Separator jSeparator1;
    private javax.swing.JToolBar.Separator jSeparator2;
    private javax.swing.JToolBar.Separator jSeparator3;
    private javax.swing.JToolBar jToolBar1;
    private javax.swing.JToolBar jToolBar2;
    private javax.swing.JToolBar jToolBar3;
    // End of variables declaration//GEN-END:variables

}
